package com.example.javadesign.chain.simple;

/**
 * @author 陳樂
 * @version 1.0.0
 * @ClassName MemberService.java
 * @Description TODO
 * @createTime 2022年12月07日 22:27:00
 */
public class MemberService {

    public void login(String loginName, String loginPass) {
        Handler validateHandler = new ValidateHandler();
        Handler loginHandler = new LoginHandler();
        Handler authHandler = new AuthHandler();

        Member member = new Member(loginName, loginPass);

        //  validate -> login -> auth
        validateHandler.next(loginHandler);
        loginHandler.next(authHandler);
        validateHandler.doHandler(member);

        //  auth -> login -> validate
//        authHandler.next(loginHandler);
//        loginHandler.next(validateHandler);
//        member.setRoleName("管理员");
//        authHandler.doHandler(member);
    }

}

